package com.xinzhitong.www.service;

import com.xinzhitong.www.exception.*;
import com.xinzhitong.www.exception.questionmessage.NoQuestionMessageException;
import com.xinzhitong.www.utils.MyPageInfo;

import java.util.List;
import java.util.Map;

/**
 * 题库服务
 *
 * @author 徐鑫 魏骆淳 钟伟良
 */
public interface QuestionBankService {

    /**
     * 获取题库
     *
     * @param professionId 工种id
     * @param pageNo       页码
     * @param pageSize     页大小
     * @return 题库
     * @throws QuestionBankException 系统繁忙异常
     */
    MyPageInfo getQuestionBanks(Integer professionId, Integer pageNo, Integer pageSize) throws QuestionBankException;

    /**
     * 获取答案是否正确
     *
     * @param questionId         题目id
     * @param questionType       题目类型
     * @param userQuestionAnswer 用户做题答案
     * @return 是否正确
     * @throws QuestionBankException 系统繁忙异常
     */
    Map<String, Object> getAnswerIsCorrect(
            Integer questionId,
            String questionType,
            List<String> userQuestionAnswer
    ) throws QuestionBankException;

    /**
     * 获取某证书下的测试
     *
     * @param credentialId 证书id
     * @return 测试信息及题型题号
     * @throws TestException 测试异常
     */
    Map<String, Object> getTestOfCredentialIdOf(Integer credentialId) throws TestException;

    /**
     * 获取工种下的所有证书的测试概览
     *
     * @param professionId 工种id
     * @return 测试信息概览
     * @throws TestException 测试异常
     */
    List<Map<String, Object>> getTestsOfProfessionOf(Integer professionId) throws TestException;

    /**
     * 获取做题信息
     *
     * @param id 证书id
     * @return 做题信息
     */
    List<Map<String, Object>> getQuestionInformationGeneral(Integer id);

    /**
     * 获取题目答案
     *
     * @param id 题目id
     * @return 题目答案
     * @throws QuestionAnalysisException 题目解析异常
     */
    Map<String, Object> getQuestionAnalysis(Integer id, String type) throws QuestionAnalysisException;

    /**
     * 获取我的错题
     *
     * @return 我的错题
     * @throws QuestionErrException 错题异常
     */
    List<Map<String, Object>> getQuestionErr() throws QuestionErrException;

    /**
     * 获取题目信息
     *
     * @param bankId   题库id
     * @param type     题目种类
     * @param pageNo   页码
     * @param pageSize 页大小
     * @return 题目
     * @throws QuestionInformationException 没有题目异常
     */
    MyPageInfo getQuestionInformation(Integer bankId, String type
            , Integer pageNo, Integer pageSize) throws QuestionInformationException;

    /**
     * 标记指定题目
     *
     * @param questionId 题目id
     * @throws QuestionSignException 题目标记异常
     */
    void signTheQuestion(Integer questionId) throws QuestionSignException;

    /**
     * 移除题目的标记
     *
     * @param questionId 题目id
     * @throws QuestionSignException 题目标记异常
     */
    void removeSignOfTheQuestion(Integer questionId) throws QuestionSignException;

    /**
     * 获取错题信息
     *
     * @return 错题id
     * @throws QuestionErrIdException 错题异常
     */
    List<Integer> getErr() throws QuestionErrIdException;

    /**
     * 获取错题题面
     *
     * @param id 错题题号
     * @return 错题题面
     * @throws QuestionInformationException 没有题目异常
     */
    Map<String, Object> getErrQuestionInformation(Integer id) throws QuestionInformationException;

    /**
     * 获取用户做题记录
     *
     * @param id 题号
     * @return 用户做题记录
     * @throws QuestionBankException 题库异常
     */
    List<String> getUserQuestionAnswer(Integer id) throws QuestionBankException;

    /**
     * 获取题库答题卡
     *
     * @param bankId 题库id
     * @return 答题卡
     * @throws QuestionCardException 题库异常
     */
    Map<String, Object> getQuestionCard(Integer bankId, String type) throws QuestionCardException;

    /**
     * 获取系统题库消息详情
     *
     * @param id 题库id
     * @return 消息详情
     * @throws NoQuestionMessageException 没有题库信息异常
     */
    Map<String, Object> getMessage(Integer id) throws NoQuestionMessageException;
}
